
package com.idealighter.game.core.common;

/**
 * 游戏枚举.
 *
 */
public enum Game {

  /**
   * DOU_DI_ZHU 斗地主.
   */
  DOU_DI_ZHU(GameIdConstant.DOU_DI_ZHU, "斗地主", 501, 0, "dou_di_zhu"),

  /**
   * ERREN_NIUNIU 二人牛牛.
   */
  ERREN_NIUNIU(GameIdConstant.ERREN_NIUNIU, "二人牛牛", 502, 0, "erren_niuniu"),

  /**
   * FOURS_SHOP 4s店.
   */
  FOURS_SHOP(GameIdConstant.FOURS_SHOP, "4s店", 504, 0, "4s_shop"),

  /**
   * TEXAPOKER 德州扑克.
   */
  TEXAPOKER(GameIdConstant.TEXAPOKER, "德州扑克", 505, 0, "texapoker"),

  /**
   * HAPPY_FIVE 欢乐五张.
   */
  HAPPY_FIVE(GameIdConstant.HAPPY_FIVE, "欢乐五张", 507, 0, "happy5"),

  /**
   * TONGBI_NIUNIU 通比牛牛.
   */
  TONGBI_NIUNIU(GameIdConstant.TONGBI_NIUNIU, "通比牛牛", 514, 0, "tongbi_niuniu"),

  /**
   * ERREN_TEXAPOKER 二人德州扑克.
   */
  ERREN_TEXAPOKER(GameIdConstant.ERREN_TEXAPOKER, "二人德州扑克", 515, 0, "erren_niuniu"),

  /**
   * HORCERACE 赛马.
   */
  HORCERACE(GameIdConstant.HORCERACE, "赛马", 516, 0, "horce_race"),

  /**
   * XZDD 血战到底.
   */
  XZDD(GameIdConstant.XZDD, "血战到底", 519, 0, "xzdd"),

  /**
   * WEISHUWU 魏蜀吴.
   */
  WEISHUWU(GameIdConstant.WEISHUWU, "魏蜀吴", 522, 0, "weishuwu"),

  /**
   * WKNH 悟空闹海.
   */
  WKNH(GameIdConstant.WKNH, "悟空闹海", 523, 0, "wknh"),

  /**
   * ODERMA 定制麻将.
   */
  ODERMA(GameIdConstant.ODERMA, "定制麻将", 524, 0, "oderma"),
  // ===================

  /**
   * SHUI_HU_ZHUAN 水浒传.
   */
  SHUI_HU_ZHUAN(GameIdConstant.SHUI_HU_ZHUAN, "水浒传", 51, 0, "shuihu"),

  /**
   * FRUIT_SLOT 水果拉霸.
   */
  FRUIT_SLOT(GameIdConstant.FRUIT_SLOT, "水果拉霸", 52, 0, "laba"),

  /**
   * FQZS 飞禽走兽.
   */
  FQZS(GameIdConstant.FQZS, "飞禽走兽", 53, 0, "fqzs"),

  /**
   * JCBY 金蟾捕鱼.
   */
  JCBY(GameIdConstant.JCBY, "金蟾捕鱼", 54, 0, "jcby"),

  /**
   * SIREN_NIUNIU 四人牛牛.
   */
  SIREN_NIUNIU(GameIdConstant.SIREN_NIUNIU, "四人牛牛", 55, 0, "siren_niuniu"),

  /**
   * LKBY 李逵捕鱼.
   */
  LKBY(GameIdConstant.LKBY, "李逵捕鱼", 56, 0, "lkby"),

  /**
   * ZJH 扎金花.
   */
  ZJH(GameIdConstant.ZJH, "扎金花", 57, 0, "zjh"),

  /**
   * BLACK_JACK 21点.
   */
  BLACK_JACK(GameIdConstant.BLACK_JACK, "21点", 58, 0, "blackjack"),

  /**
   * BACCARAT 百家乐.
   */
  BACCARAT(GameIdConstant.BACCARAT, "百家乐", 59, 0, "baccarat"),

  /**
   * BAIREN_NIUNIU 百人牛牛.
   */
  BAIREN_NIUNIU(GameIdConstant.BAIREN_NIUNIU, "百人牛牛", 60, 0, "bairen_niuniu"),

  /**
   * MUST_NIUNIU 一定要牛.
   */
  MUST_NIUNIU(GameIdConstant.MUST_NIUNIU, "一定要牛", 0, 81, "must_niuniu")

  ;
  // 游戏类型id
  private final int type;
  // 游戏描述
  private final String desc;
  // 游戏模块id，通过它可以获取游戏线程执行器
  private final int moduleId;
  // 房卡游戏模块id
  private final int roomCardModuleId;
  // tag
  private final String tag;

  /**
   * 构造函数.
   * 
   * @param type .
   * @param desc .
   * @param moduleId .
   */
  private Game(int type, String desc, int moduleId, int roomCardModuleId, String tag) {
    this.type = type;
    this.desc = desc;
    this.moduleId = moduleId;
    this.roomCardModuleId = roomCardModuleId;
    this.tag = tag;
  }

  /**
   * 获取游戏类型.
   * 
   * @param type .
   * @return .
   */
  public static Game getGame(int type) {
    for (Game game : Game.values()) {
      if (game.type == type) {
        return game;
      }
    }

    return null;
  }

  @Override
  public String toString() {
    return type + "_" + desc;
  }

  public int getType() {
    return type;
  }

  public String getDesc() {
    return desc;
  }

  public int getModuleId() {
    return moduleId;
  }

  public String getTag() {
    return tag;
  }

  public int getRoomCardModuleId() {
    return roomCardModuleId;
  }
}
